home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / misc / felix / source / windowlist.h < prev   
C/C++ Source or Header  |  1999-01-25  |  7KB  |  231 lines

  1. //*************************************************************************//
  2. // Filename:    WindowList.h
  3. // Autor:       Christian Taulien of Strange Intelligence
  4. // Purpose:     definition of used classes
  5. // Creation:    24. März 1998
  6. //*************************************************************************//
  7. #ifndef WINDOWLIST_H
  8. #define WINDOWLIST_H
  9. extern struct Window;
  10.  
  11. #include "global.h"
  12. #include "flxclasses.h"
  13. //*/ // Für GoldED 5 aktivieren
  14. #include "golded:developer/api/include/apilib.h"
  15. #include "golded:developer/include/editor.h"
  16. /*/ // Für GoldED 4 aktivieren
  17. #include "golded:developer/api/include/api.h"
  18. #include "golded:developer/golded/include/golded.h"
  19. //*/
  20.  
  21. #include <exec/types.h>
  22. #include <exec/nodes.h>
  23. #include <exec/lists.h>
  24. #include <intuition/intuition.h>
  25. class WNameListC;
  26.  
  27. //*************************************************************************//
  28. //.klasse
  29. //KLASSENNAME   : WNameNodeC
  30. //VERSION       : 24. März 1998
  31. //AUTOR         : Taulien
  32. //AUFGABE       : Eine Klasse zur Verwaltung eines WindowNames in einer Liste
  33. //DOKUMENTATION : -
  34. //BEMERKUNGEN   : -
  35. //AENDERUNGEN   : -
  36. //*************************************************************************//
  37. struct WNameNodeC : public struct Node
  38. {
  39.   friend class WNameListC;
  40. private:
  41.   // ## methods
  42.   WNameNodeC(struct APIInstance *arg_poInstance, WNameListC *arg_poNameList);
  43.  
  44. public:
  45.   // ## datamembers
  46.     // Zeiger auf die GoldED-API-Struktur für das Textfenster
  47.   struct APIInstance *m_poAPIInstance;
  48.  
  49.     // Flag das angibt, ob das Fenster zuletzt als modifiziert angezeigt wurde
  50.   BOOL                m_bModified;
  51.  
  52.   // ## methods
  53.   ~WNameNodeC();
  54.  
  55.   char *getFileName(void) { return ln_Name; };
  56.   WNameNodeC *getNext(void);
  57.   WNameNodeC *getPrev(void);
  58. };
  59.  
  60. //*************************************************************************//
  61. //.klasse
  62. //KLASSENNAME   : WNameListC
  63. //VERSION       : 24. März 1998
  64. //AUTOR         : Taulien
  65. //AUFGABE       : Eine Klasse für die Verwaltung der WindowName-Liste
  66. //DOKUMENTATION : -
  67. //BEMERKUNGEN   : -
  68. //AENDERUNGEN   : -
  69. //*************************************************************************//
  70. class WNameListC : public struct List
  71. {
  72. public:
  73.   WNameListC();
  74.   ~WNameListC();
  75.  
  76.   void removeAll();
  77.   BOOL addWName(struct APIInstance *arg_poInstance);
  78.   int sortIn(struct APIInstance *arg_poInstance);
  79.   WNameNodeC *findWName(struct APIInstance *arg_poInstance);
  80.   WNameNodeC *getFirst() { return (WNameNodeC *) lh_Head; };
  81.   int indexOf(WNameNodeC *arg_pNode);
  82.   int getSize();
  83.  
  84.   WNameNodeC *operator[](int arg_iIndex);
  85. };
  86.  
  87. //*************************************************************************//
  88. //.klasse
  89. //KLASSENNAME   : VisualInfoC
  90. //VERSION       : 28. März 1998
  91. //AUTOR         : Taulien
  92. //AUFGABE       : Eine Hilfsklasse-Klasse für die Verwaltung von VisualInfos
  93. //DOKUMENTATION : -
  94. //BEMERKUNGEN   : -
  95. //AENDERUNGEN   : -
  96. //*************************************************************************//
  97. class VisualInfoC
  98. {
  99. private:
  100.   // ## private Datamembers ##
  101.   APTR  m_iVisualInfo;
  102.  
  103.   // ## private Methods ##
  104.   void initVisualInfo(struct Screen *arg_poScreen);
  105.  
  106. public:
  107.   // ## public Methods ##
  108.   VisualInfoC(struct Window *arg_poWindow)
  109.     { initVisualInfo(arg_poWindow->WScreen); };
  110.   VisualInfoC(struct Screen *arg_poScreen)
  111.     { initVisualInfo(arg_poScreen); };
  112.   virtual ~VisualInfoC();
  113.  
  114.   BOOL isOk(void)   { return m_iVisualInfo ? TRUE : FALSE; };
  115.  
  116.   // # operator overriding
  117.   operator APTR()   { return m_iVisualInfo; };
  118.   BOOL operator !() { return !isOk(); };
  119. };
  120.  
  121. //*************************************************************************//
  122. //.klasse
  123. //KLASSENNAME   : HookC
  124. //VERSION       : 20. November 1998
  125. //AUTOR         : Christian Taulien of Strange Intelligence
  126. //AUFGABE       : Diese Klasse repräsentiert einen Hook und stellt gleich-
  127. //                zeitig die Hookfunktion bereit.
  128. //DOKUMENTATION : -
  129. //BEMERKUNGEN   : -
  130. //AENDERUNGEN   : -
  131. //*************************************************************************//
  132. class HookC
  133. {
  134. private:
  135.   // ## private datamembers ##
  136.     // Objektgebundener Hook zum anspringen der doHookFunc()-Methode
  137.   struct Hook         m_oHook;
  138.  
  139. protected:
  140.   // ## protected datamembers ##
  141.     // This Methods will be called by the Hooks
  142.   virtual ULONG onHook(struct Hook *arg_poHook, APTR arg_pObject, APTR arg_pParms);
  143.  
  144.     // our SIFC_HookEntry-Function needs to call onHook() which is protected.
  145.   friend static ULONG SIFC_HookEntry(register __a0 struct Hook *arg_poHook,
  146.                                      register __a1 APTR arg_pObject,
  147.                                      register __a2 APTR arg_pParms);
  148.  
  149. public:
  150.   // ## public methods ##
  151.   HookC();
  152.   virtual ~HookC() {}
  153.  
  154.   // Infos
  155.   struct Hook *getHook() { return &m_oHook; }
  156.   operator struct Hook *() { return &m_oHook; }
  157. };
  158.  
  159. //*************************************************************************//
  160. //.klasse
  161. //KLASSENNAME   : WindowListC
  162. //VERSION       : 27. März 1998
  163. //AUTOR         : Taulien
  164. //AUFGABE       : Eine Klasse für die Verwaltung in GoldED geöffneter Fenster
  165. //DOKUMENTATION : -
  166. //BEMERKUNGEN   : -
  167. //AENDERUNGEN   : -
  168. //*************************************************************************//
  169. class WindowListC
  170. {
  171. private:
  172.   enum
  173.   {
  174.     IDC_LISTE,
  175.     IDC_OKAY,
  176.     IDC_CLOSE,
  177.     IDC_CANCEL,
  178.     GAD_ANZAHL
  179.   };
  180.  
  181.   // ## private Datenmember ##
  182.   static char *m_asButtonLabels[GAD_ANZAHL];
  183.   static int   m_iLeft;
  184.   static int   m_iTop;
  185.   int          m_iWinHeight;
  186.   int          m_iWinWidth;
  187.   int          m_iMaxVisibleEntries;
  188.   BOOL         m_bGadgetsAttached;
  189.  
  190.   FLXWatchListC   *m_poWatches;
  191.   struct Gadget   *m_poFirstGadget;
  192.   struct Gadget   *m_apoGadgets[GAD_ANZAHL];
  193.   struct Window   *m_poWindow;
  194.   struct Rectangle m_oLVRect;
  195.   WNameListC       m_oWindowNameList;
  196.   HookC            m_oListViewCallBack;
  197.  
  198.   // ## private Methoden ##
  199.   char *getSelectedName();
  200.   struct Gadget *createGadgets(struct Screen *arg_pScreen);
  201.   void freeGadgets();
  202.   void validateWindowPosition(struct Screen *arg_poScreen);
  203.  
  204. public:
  205.   // ## public Methoden ##
  206.   WindowListC(FLXWatchListC *arg_poWatches);
  207.   virtual ~WindowListC();
  208.  
  209.   BOOL isOpen() { return m_poWindow ? TRUE : FALSE; }
  210.   BOOL isWNameListEmpty() { return IsListEmpty(&m_oWindowNameList); }
  211.   BOOL openWindowList(struct APIMessage *apiMsg);
  212.   void closeWindowList();
  213.   BOOL SAVEDS handleWindowList();
  214.   void updateWindowList(struct APIInstance *arg_poInstance);
  215.   void updateModifiedFlag(struct APIInstance *arg_poInstance);
  216.   void setMaxVisibleEntries(int arg_iCount)
  217.                 { m_iMaxVisibleEntries = arg_iCount; }
  218.   void setWindowPosition(int arg_iX = -1, int arg_iY = -1, BOOL arg_bNow = TRUE);
  219.   void clearWindow();
  220.   void hideGadgets();
  221.   void showGadgets();
  222.   void resizeWindow(int arg_iEntries = 0, int arg_iX = -1, int arg_iY = -1);
  223.   struct Window *getWindow() { return m_poWindow; }
  224.   WNameListC *getWNameList() { return &m_oWindowNameList; }
  225.   void drawSeperator(int arg_iOffset);
  226.   void refreshDesign();
  227.  
  228. };
  229.  
  230. #endif //WINDOWLIST_H
  231.